<!-- 操作指引显示 -->
<template>
  <a-modal v-model="visible" width="60%" title="岗位操作指引" :footer='null' :keyboard="false" :maskClosable="false" @cancel="cancelFn">
    <a-spin :spinning="loading">
      <a-form-model ref="ruleForm" :model="form" :rules="rules" :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" :wrapperCol="{ lg: { span: 18 }, sm: { span: 18 } }">
        <a-col>
          <a-form-model-item label="操作指引" prop="postManual">
            <editor-bar v-model="form.postManual" :disabled="true"></editor-bar>
          </a-form-model-item>
        </a-col>
        <a-col>
          <a-form-model-item label="附件信息">
            <upload-list :businessCode="'BM22'" :isClose="false" :uploadArrys.sync="form.fileInfoList" multiple></upload-list>
          </a-form-model-item>
        </a-col>
      </a-form-model>
      <div class="custom-button">
        <a-button @click="cancelFn">关闭</a-button>
      </div>
    </a-spin>
  </a-modal>
</template>
<script>
import EditorBar from '@/components/Editor/editor'
import UploadList from '@/components/UploadList'
import { getAcloudPostManualByPostCode } from '@/api/system/system'
export default {
  name: 'OperationalGuidelineView',
  components: {
    EditorBar,
    UploadList
  },
  data() {
    return {
      visible: true,
      loading: true,
      form: {
        postManual: '',
        fileInfoList: []
      },
      isClear: false,
      rules: {},
    }
  },
  created() {
    // 根据code查询操作指引详情信息
    let code = JSON.parse(sessionStorage.getItem('ycloud-user_info')).currentPost.postCode;  // 获取当前登录人员的岗位code
    getAcloudPostManualByPostCode({ postCode: code}).then((res) => {
      console.log('567890', res)
      if (res.code == '0' || res.code == '200' || res.data.code == '0') {
        if (res.data || res.data.data) {
          this.form = res.data || res.data.data;
        }
        this.loading = false;
      }else {
        this.$message.error('详情查询失败');
        this.loading = false;
      }
    }).catch(err => {
      this.loading = false;
    })
  },
  methods: {
    // 弹窗按钮回调函数
    cancelFn() {
      this.$emit('click', { type: 'close' })
    }
  }
}
</script>
<style lang="less" scoped>
.custom-button {
    height: auto;
    overflow: hidden;
    text-align: right;
}

::v-deep {
  .ant-form-item .ant-form-item-label {
    width: 80px;
  }
}
</style>